var redis=require('redis');
var c=redis.createClient();
var start=Date.now();

(function mock(i){
    if(i>10000*100){
        var now=Date.now();
        console.log('写入耗时:',now-start);
        c.keys('history:user_*&time_*&sku_*',(err,ret)=>{
            console.log('keys:',ret.length,'读取耗时：',Date.now()-now);
        });
        setTimeout(()=>{
            c.keys('history:user_*&time_*&sku_*',(err,ret)=>{
                console.log('3s keys:',ret.length);
            });
        },1000*3);
        return;
    }
    var key='history:user_'+(Math.random()*10|0)+'&time_'+Date.now()+'&sku_'+(Math.random()*500|0);
    //console.log('key:',key);
    c.setex(key,2,key,(err,ret)=>{
        if(err)throw err;
        //console.log('ret:',ret);
        mock(++i);
    });
})(0);

/*
c.keys('his:user_0*_T0*',(err,ret)=>{
    console.log(err,ret);
});*/
